/***************************************************************************
 *   Copyright (C) 2007 by Warren Kenny   				   *
 *   warren.kenny@gmail.com   						   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef GSCONTAINER_H
#define GSCONTAINER_H

#include <gsCore/gsCore.h>

/**
 *	This class declares key virtual methods that should be implemented by all single-dimension container classes within the general systems project
 */
template<class T>
class gsContainer
{
	
public:
	
	/**
	 *        Default Constructor
	 */
	gsContainer()
	{}

    	/**
    	 * 	Generic method for inserting an object into the container
    	 * @param object The object to be inserted
    	 * @return 	- True is the object was successfully inserted
	 *		- False otherwise
    	 */
    	virtual gsBool insert( const T& object ) = 0;
	
	/**
	 * 	Generic method for removing an object from the container
	 * @param object The object to be removed
	 * @return 	- True if the object was found and removed successfully
	 *		- False otherwise
	 */
	virtual gsBool remove( const T& object ) = 0;
	
	/**
	 * 	Generic function for indicating whether a given object exists within the container
	 * @param object The object to be found
	 * @return 	- True if the object was found
	 *		- False otherwise
	 */
	virtual gsBool find( const T& object ) = 0;
	
	/**
	 *        Generic function for retrieving an object from the specified index within the container
	 * @param index The index within the container from which the object should be retrieved
	 * @param[out] object A reference to the object to be set
	 * @return 	- True if the object was retrieved
	 *		- False otherwise
	 */
	virtual gsBool get( const gsUInt index, T& object ) = 0;
	
	/**
	 *	Generic function for indicating whether the container is empty
	 * @return 	- True if the container is empty
	 *		- False if the container holds one or more objects
	 */
	virtual gsBool empty() = 0;
	
	/**
	 *	Generic function for finding the number of elements in the container
	 * @return	The number of elements in the container 
	 */
	virtual const gsUInt getSize() = 0;
	
	/**
	 *        Generic function for finding the current storage capacity of the container
	 * @return 	The current storage capacity of the container
	 */
	virtual const gsUInt getCapacity() = 0;
	
	/**
	 *        Generic function for removing all objects from the container and reducing the container's storage to zero
	 */
	virtual void clear() = 0;
	
	/**
	 * 	Default destructor
	 */
	virtual ~gsContainer()
	{}
};

#endif
